﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DungeonCraft.DataModel;
using DungeonCraft.Engine.Interfaces;
using Microsoft.Xna.Framework;

namespace DungeonCraft.Views
{
    class LevelView : AView<Level>
    {

        public LevelView(IRenderer iRenderer, IAnimationManager iAnimationManager)
            : base(iRenderer, iAnimationManager)
        {
        }

        public override void Draw(Level target)
        {
            for (int i = 0; i < target.GroundTypesList.GetUpperBound(0); i++)
            {
                renderer.DrawSprite("Ground", i * 10, -15, 10, 15, new Rectangle(), Color.Green);
            }
            for (int j = 0; j < target.GroundTypesList.GetUpperBound(1); j++)
            {
                renderer.DrawSprite("Ground", -10, j * 15, 10, 15, new Rectangle(), Color.Green);
            }

            for(int i = 0; i < target.GroundTypesList.GetUpperBound(0); i++)
            {
                for(int j = 0; j < target.GroundTypesList.GetUpperBound(1); j++)
                {
                    if (target.GroundTypesList[i, j] == Level.GroundTypes.jumpable)
                    {
                        renderer.DrawSprite("water", i * 10, j * 15, 10, 15, new Rectangle(0, 0, 400, 320), Color.White);
                    }
                    else
                    {
                        renderer.DrawSprite("Grass", i * 10, j * 15, 10, 15, new Rectangle(0,0,3871, 2592), Color.White);
                    }
                }
            }
        }


    }
}
